<?php echo $header; ?>
<div id="content">
  <div class="breadcrumb">
    <?php echo $this->breadCrumbs(); ?>
  </div>
  
  <?php if (isset($error_warning)) { ?>
  <div class="warning"><?php echo $error_warning; ?></div>
  <?php } ?>
  <?php if ($success) { ?>
  <div class="success"><?php echo $success; ?></div>
  <?php } ?>
  
  <div class="box">
    <div class="heading">
      <h1><img src="view/image/product.png" alt="" /> <?php echo $_['heading_title']; ?></h1>
      <div class="buttons">
	  <a href="<?php echo UA('catalog/topic/insert'); ?>" class="button"><span><?php echo $_['button_insert'];?></span></a>
	  <a onclick="$('form').submit();" class="button"><span><?php echo $_['button_delete'];?></span></a>
	  </div>
    </div>
    <div class="content">
      <form action="<?php echo UA('catalog/topic/delete'); ?>" method="post" enctype="multipart/form-data" id="form">
        <table class="J_tablelist list" data-acturi="<?php echo UA('catalog/topic/smartedit');?>">
          <thead>
            <tr>
              <td width="1" style="text-align: center;"><input type="checkbox" onclick="$('input[name*=\'selected\']').attr('checked', this.checked);" /></td>
              <td class="left">
                <?php echo $_['column_title']; ?>
               </td>
			  <td><?php echo $_['column_date_start']; ?></td>
              <td><?php echo $_['column_date_end']; ?></td>
              <td><?php echo $_['column_status']; ?></td>
              <td width="60" class="right"><?php echo $_['column_action']; ?></td>
            </tr>
          </thead>
          <tbody>
            <?php if ($topics) { ?>
            <?php foreach ($topics as $topic) { ?>
            <tr onmouseover="this.className='on';" onmouseout="this.className='';">
              <td style="text-align: center;">
                <input type="checkbox" name="selected[]" value="<?php echo $topic['topic_id']; ?>" />
              </td>
			  <td class="left"><a href="<?php echo U('product/topic', "topic_id={$topic['topic_id']}"); ?>" target="_blank"><?php echo $topic['title']; ?></a></td>
			  <td class="left"><span data-tdtype="edit" data-field="date_start" data-id="<?php echo $topic['topic_id'];?>"><?php echo $topic['date_start']; ?></span></td>
			  <td class="left"><span data-tdtype="edit" data-field="date_end" data-id="<?php echo $topic['topic_id'];?>"><?php echo $topic['date_end']; ?></span></td>
			  <td class="center"><img class="cur" src="view/image/<?php echo $topic['status'] ? 'enabled' : 'disabled'; ?>.png" data-tdtype="toggle" data-field="status" data-id="<?php echo $topic['topic_id'];?>" data-value="<?php echo $topic['status']; ?>"></td>
			  <td class="right">
			  [<a href="<?php echo UA('catalog/topic/update');?>&topic_id=<?php echo $topic['topic_id'];?>"><?php echo $_['text_edit']; ?></a>]
			  </td>
            </tr>
            <?php } ?>
            <?php } else { ?>
            <tr>
              <td class="center" colspan="10"><?php echo $_['text_no_results']; ?></td>
            </tr>
            <?php } ?>
          </tbody>
        </table>
      </form>
      <div class="pagination"><?php echo $pagination; ?></div>
    </div>
  </div>
</div>
<script type="text/javascript"><!--
$('#form input').keydown(function(e) {
	if (e.keyCode == 13) {
		filter();
	}
});

function filter() {
	url = '<?php echo UA('catalog/supplier');?>&filter_reset=1';	
	var keyword = $('input[name=\'keyword\']').attr('value');	
	if (keyword) {
		url += '&keyword=' + encodeURIComponent(keyword);
	}
	location = url;
}

$('.J_tablelist').listTable();
//--></script> 
<?php echo $footer; ?>